﻿using NUnit.Framework;
using Spring.Context;
using Spring.Context.Support;

using System.Collections.Generic;
using OpenSda.Agilcont.Common.Business.Contracts;
using OpenSda.Agilcont.Common.Data.Entities;
using OpenSda.Agilcont.Common.Data.Contracts;
using OpenSda.Agilcont.Common.Business.Exceptions;

namespace OpenSda.Agilcont.Common.Business.SfContexts.NmTest
{
    [TestFixture]
    public class ModuleAccessBusinessTest : AbstractBaseDataTests
    {
        private IModuleAccessBusiness target;
        public IModuleAccessBusiness ModuleAccesBusiness { set { target = value; } }
        private IUserData userData;
        public IUserData UserData { set { userData = value; } }

        [Test]
        [ExpectedException(typeof(ModuleAccessCannotBeNullException))]
        public void SaveWhenModuleAccessIsNullTest()
        {
            target.Save(null);
        }

        [Test]
        public void SaveTest()
        {
            ModuleAccess moduleAccess = this.Save();
            Assert.IsNotNull(moduleAccess.Module);
        }
        private ModuleAccess Save()
        {
            //User u = userData.GetAll()[0];
            return target.Save(new ModuleAccess()
            {
                Module = "aapp14"
                //UserManagementRef = u

            });
        }

    }
}
